package com.server.order;

import gnu.cajo.invoke.Remote;

import java.io.Serializable;
import java.rmi.RemoteException;

import combat.protocol.data.DoublePoint;
import combat.protocol.interfaces.OrderInt;
import combat.protocol.types.OrderType;

public class orderImpl extends com.server.misc.NewID.OrderID implements OrderInt, Serializable {
	private static final long serialVersionUID = 1L;
	
	private int orderID = -1;
	private Object target = new DoublePoint(0, 0);
	private OrderType type = OrderType.UNKNOWN;

	public orderImpl() {
		this.orderID = getID();
	}
	public orderImpl(Object target, OrderType type) {
		this.orderID = getID();
		this.target = target;
		this.type = type;
	}
	
	public int getOrderID() {
		return this.orderID;
	}

	public void setOrderID(int orderID) {
		this.orderID = orderID;
	}

	public Object getTarget() {
		return this.target;
	}

	public void setTarget(DoublePoint target) {
		this.target = target;
	}

	public OrderType getType() {
		return this.type;
	}

	public void setType(OrderType type) {
		this.type = type;
	}

	public void setTarget(Object target) {
		this.target = target;
	}
	@Override
	public Remote getTarget_Remote() {
		try {
			return new Remote(getTarget());
		} catch (RemoteException e) {
			System.out.println("ERROR: Update getTarget function failed");
		}
		return null;
	}
	
}
